<?php

namespace app\common\services;

use app\common\model\Sysmessage as SysmessageModel;
use think\facade\Db;

use think\facade\Cache;

class SysmessageService
{
    
    // 消息详情
    public static function info($id){
        
        $info = SysmessageModel::where('id',$id)->find();
        return $info;
    }
    

    public static function list(array $data,$page_info)
    {
        return SysmessageModel::where($data)
            ->whereOr('user_id',0)
            ->order('createtime desc')
            ->paginate($page_info['num'])->toArray();
    }


    /**
     * 消息添加
     */
    public static function add($data){
        
        $feedback = new SysmessageModel;
        $feedback->allowField(true)->save($data);
    }

    
    /**
     * 删除消息
     *
     * @param [type] $id
     * @return void
     */
    public static function del($id)
    {
        return BannerModel::where('id',$id)->delete();
    }
}